package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TExpertTitleInfoTemp;
import cn.com.headfree.mouldshow.dao.TExpertTitleInfoTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tExpertTitleInfoTempDao")
public class TExpertTitleInfoTempDaoImpl extends BaseDaoImpl<TExpertTitleInfoTemp> implements TExpertTitleInfoTempDao {


    @Override
    public void saveInfo(TExpertTitleInfoTemp tExpertTitleInfo) {
        String sql = "insert into t_expert_title_info_temp (id,erp_no,user_name,id_card_no,major,acqu_time,level_name,emp_title,type,emp_term_start,emp_term_end,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,business_type_id,primitive_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
                .append("#{id_card_no,jdbcType=VARCHAR},").append("#{major,jdbcType=VARCHAR},")
                .append("#{acqu_time,jdbcType=DATE},").append("#{level_name,jdbcType=VARCHAR},").append("#{emp_title,jdbcType=VARCHAR},")
                .append("#{type,jdbcType=VARCHAR},").append("#{emp_term_start,jdbcType=DATE},")
                .append("#{emp_term_end,jdbcType=DATE},").append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
                .append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
                .append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
                .append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
                .append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},")
                .append("#{orignal_id,jdbcType=VARCHAR},").append("#{business_type_id,jdbcType=VARCHAR},")
                .append("#{primitive_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tExpertTitleInfo.getId());
        params.put("erp_no", tExpertTitleInfo.getErpNo());
        params.put("user_name", tExpertTitleInfo.getUserName());
        params.put("id_card_no", tExpertTitleInfo.getIdCardNo());
        params.put("major", tExpertTitleInfo.getMajor());
        params.put("acqu_time", tExpertTitleInfo.getAcquTime());
        params.put("level_name", tExpertTitleInfo.getLevelName());
        params.put("emp_title", tExpertTitleInfo.getEmpTitle());
        params.put("type", tExpertTitleInfo.getType());
        params.put("emp_term_start", tExpertTitleInfo.getEmpTermStart());
        params.put("emp_term_end", tExpertTitleInfo.getEmpTermEnd());
        params.put("org_id", tExpertTitleInfo.getOrgId());
        params.put("creater_id", tExpertTitleInfo.getCreaterId());
        params.put("creater_name", tExpertTitleInfo.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tExpertTitleInfo.getUpdaterId());
        params.put("updater_name", tExpertTitleInfo.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("is_valid", tExpertTitleInfo.getIsValid());
        params.put("audit_state", tExpertTitleInfo.getAuditState());
        params.put("orignal_id", tExpertTitleInfo.getOrignalId());
        params.put("business_type_id", tExpertTitleInfo.getBusinessTypeId());
        params.put("primitive_id", tExpertTitleInfo.getPrimitiveId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
